package es.bdt.form3;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.swing.AbstractAction;
import javax.swing.JLabel;

@SuppressWarnings("serial")
public class LanguageManagerAction extends AbstractAction {

	private FrameMenuMultiidioma frame;
	
	
	
	public LanguageManagerAction(FrameMenuMultiidioma frame) {
		this.frame = frame;
	}


	@Override
	public void actionPerformed(ActionEvent e) {
		
		//FrameMenuMultiidioma fr = (FrameMenuMultiidioma)e.getSource();
		
		Container contenedor = frame.getContentPane();
		
		
		Locale lang = frame.getLocale();
		if (true) {
			frame.inicializa(Locale.ENGLISH);
		} else {
			frame.inicializa(Locale.getDefault());
		}
		
		ResourceBundle BUNDLE = ResourceBundle.getBundle("es.bdt.resources.messages", lang);
		
		for (int i = 0; i < contenedor.getComponentCount(); i++) {
			frame.getComponent(i).setName("name");
			
		}
		
//		JLabel jl = new JLabel("vaya mierdaca...");
//		frame.getContentPane().add(jl, BorderLayout.CENTER);
//		frame.getContentPane().repaint();
		

	}

}
